package com.scanner;

import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;

public class Invoker {

	private Object target;

	private Method method;

	public static Invoker initInVoker(Object target, Method method){
		
		Invoker invoker = new Invoker();
		invoker.setMethod(method);
		invoker.setTarget(target);
		
		return invoker;
		
	}
	
	public Object invoke(Object[] args){
		try {
			method.invoke(target, args);
		} catch (IllegalAccessException | IllegalArgumentException
				| InvocationTargetException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
		return null;
	}
	
	
	
	public Object getTarget() {
		return target;
	}

	public void setTarget(Object target) {
		this.target = target;
	}

	public Method getMethod() {
		return method;
	}

	public void setMethod(Method method) {
		this.method = method;
	}

}
